package cn.anzhiyublog.staranimegallery.exception;

import cn.anzhiyublog.staranimegallery.model.enums.StatusCode;
import lombok.Getter;

/**
 * 涉及业务内的自定义异常
 *
 * @author 安知一只鱼
 */
@Getter
public class GalleryException extends RuntimeException {
    /**
     * 错误码
     */
    private final int code;

    public GalleryException(int code, String message) {
        super(message);
        this.code = code;
    }

    public GalleryException(StatusCode statusCode) {
        super(statusCode.getMessage());
        this.code = statusCode.getCode();
    }

    public GalleryException(StatusCode statusCode, String message) {
        super(message);
        this.code = statusCode.getCode();
    }
}
